import React, { FC } from 'react';
// import {withRouter,RouteComponentProps} from "react-router"
import { useHistory } from 'umi';
import { Ireading } from '../utils/know';
import moment from 'moment';
import '../utils/font_1hsfvuvglv9/iconfont.css';
import './rightTop.less';
import Thetime from "../store/modules/index"
interface Iitem {
  item: Ireading;
}
const RightTop: React.FC<Iitem> = (props) => {
  let item = props.item;
  //计算时间
    let allTimes = Thetime(item.publishAt as string | number);
  const history = useHistory();
  function goDetail(item: Ireading) {
    history.push('/page/readDetail', item.id);
  }
  return (
    <div className="top">
      <ul>
        <li onClick={() => goDetail(item)}>
          <span>{item.title}</span> &emsp; <span>{allTimes}</span>
        </li>
      </ul>
    </div>
  );
};

export default RightTop;
